<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<? include '../console/judge_console.php'; ?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="../css/iframe01.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body{
	padding-top:30px;
	padding-left:20px;
	font:15px '微软雅黑';
	color:#666;
}

.button_1{
	border:0;
	background:url(../image/button_1.jpg) no-repeat;
	background-size:100% 100%;
	width:120px; height:30px;
	color:#FFF;
	font:15px '微软雅黑';
	letter-spacing:2px;
}
.button_1:hover{
	background:url(../image/button_1_hover.jpg) no-repeat;
	background-size:100% 100%;
}
.button_2{
	border:0;
	background-color:#3C3;
	border-radius:2px;
	width:60px; height:25px;
	color:#FFF;
	font:15px '微软雅黑';
	letter-spacing:2px;
}
table td{ border:0;}
label{
	font-size:15px;
	color:#333;
}

.file-box{ position:relative;width:340px} 
.txt{ width:200px; height:23px; margin:0; padding:0;} 
.btn{ background-color:#FFF; border:1px solid #CDCDCD; width:65px; height:25px; font:13px '微软雅黑';} 
.file{ position:absolute; top:0; right:40px; height:24px; filter:alpha(opacity:0);opacity: 0;width:260px } 

</style>
</head>

<?php
if(isset($_POST['submit'])){
	$gamename=$_POST['gamename'];
	$version=$_POST['version'];
	$date=$_POST['date'];
	$executor=$_POST['executor'];
	$result=$_POST['result'];
	$operater=$_POST['operater'];
	$detail=$_POST['detail'];
	$detail=str_replace(array("\r\n","\n"),"<br>",$detail);
	
	if($gamename==NULL||$_FILES['judgeword']['name']==NULL||$version==NULL||$executor==NULL||$operater==NULL){
		alert("信息不全");
		open("./judge_iframe_add.php","_self");
	}else{
	
	if(isset($_FILES['judgeword'])){
		$judgeword=$_FILES['judgeword'];
		$now=date("Ymdhis");
	    $file_name=$now.$judgeword['name'];
        move_uploaded_file("$judgeword[tmp_name]","../judge/".iconv("UTF-8","gb2312",$file_name));
		
		$file_name="../judge/$file_name";
	}else{
		$file_name="";
	}
	
	$mysql=new Mysql();
	$status=$mysql->addJudge($gamename,$version,$date,$executor,$result,$operater,$detail,$file_name);
	
	if($status==1){
		alert("添加成功!");
	}else{
		alert("添加失败!");
	}
	}
}
?>

<body>
<table width="80%" align="left" border="0" cellpadding="0" cellspacing="0" height="400">
<form action="./judge_iframe_add.php" method="post" enctype="multipart/form-data">
<tr><td width="100"><label>游戏名称:</label></td><td><input type="text" name="gamename" class="text02" /></td></tr>
<tr><td><label>版本号:</label></td><td><input type="text" name="version" class="text02" /></td></tr>
<tr><td><label>评测时间:</label></td><td><input type="text" name="date" class="text02" /> </td></tr>
<tr><td><label>评测公司:</label></td><td><input type="text" name="executor" class="text02" /></td></tr>
<tr><td><label>评测结果:</label></td><td><input type="text" name="result" class="text02" /></td></tr>
<tr><td><label>提交人:</label></td><td><input type="text" name="operater" class="text02" /></td></tr>
<tr><td><label>评测说明:</label></td><td><textarea name="detail" class="textarea"></textarea></td></tr>
<!--<tr><td><label>简历:</label></td><td><input type="file" name="resume" /></td></tr>-->
<tr><td><label>评测文档:</label></td><td>
<div class="file-box"> 
<input type='text' name='textfield1' id='textfield1' class='txt' /> 
<input type='button' class='button_2' value='浏览...' /> 
<input type="file" name="judgeword" class="file" id="fileField" size="28" onchange="document.getElementById('textfield1').value=this.value" />
</div>
</td></tr>
<tr><td colspan="2"><input type="submit" value="提交" name="submit" class="button01" /></td></tr>
</form>
</table>
</body>
</html>